<template>
  <div>
      <h1>我是子组件一</h1>
      <h1>{{num}}</h1>
      <h1>父组件的数据{{num_p}}</h1>
      <h1>子组件的数据{{age}}</h1>
      <button @click="change_num">点击我修改num</button>
      <button @click="addage">点击我修改父组件的数据通过父实例</button>
      <button @click="changeone">反向props修改父组件的数据</button>
  </div>
</template>

<script>
export default {
data() {
    return {
        num:20,
        age:18
    }
},
props:['num_p','changeone'],
methods: {
    change_num(){
        this.num+=5
    },
    addage(){
         this.$parent.age += 5
    }
},
}
</script>

<style>

</style>